#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#define maxsize 100
using namespace std;
typedef char elemtype;
struct cqueuetp {
	elemtype elem[maxsize];
	int front, rear;
};
void InitQueue(cqueuetp& sq) {
	sq.front = sq.rear = 0;
}
void EnQueue(cqueuetp& sq, elemtype x) {
	if ((sq.rear + 1) % maxsize == sq.front) {
		std::cout << "overflow" << std::endl;
	}
	else
	{
		sq.rear = (sq.rear + 1) % maxsize;
		sq.elem[sq.rear] = x;
	}
}
elemtype DelQueue(cqueuetp& sq) {
	if (sq.front == sq.rear)
	{
		cout << "empty!" << endl;
		return NULL;
	}
	else
	{
		sq.front = (sq.front + 1) % maxsize;
		return (sq.elem[sq.front]);
	}
}
int main(int argc, char** argv) {
	cqueuetp sq;
	InitQueue(sq);
	EnQueue(sq, 'A');
	EnQueue(sq, 'B');
	EnQueue(sq, 'C');
	EnQueue(sq, 'D');
	EnQueue(sq, 'E');
	cout << DelQueue(sq) << "\t";
	cout << DelQueue(sq) << "\t";
	cout << DelQueue(sq) << "\t";
	cout << DelQueue(sq) << "\t";
	cout << DelQueue(sq) << "\t";
	return 0;
}